<?xml version="1.0" encoding="utf-8" ?> 
<sqlMap namespace="OrderDetailKou"
	xmlns="http://ibatis.apache.org/mapping" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<alias>
		<typeAlias alias="OrderDetailKou" type="Domain.OrderDetailKou" />
	</alias>

	<resultMaps>
		<resultMap id="FullResultMap" class="OrderDetailKou">
			<result property="id" column="id" dbType="Int"/>
			<result property="orderId" column="orderId" dbType="Int"/>
			<result property="name" column="name" dbType="VarChar"/>
			<result property="guigegao" column="guigegao" dbType="Decimal"/>
			<result property="guigekuan" column="guigekuan" dbType="Decimal"/>
			<result property="guigeshen" column="guigeshen" dbType="Decimal"/>
			<result property="danshuangkou" column="danshuangkou" dbType="VarChar"/>
			<result property="jicaikuangban" column="jicaikuangban" dbType="VarChar"/>
			<result property="jicaikouxian" column="jicaikouxian" dbType="VarChar"/>
			<result property="kouxianxianxing" column="kouxianxianxing" dbType="VarChar"/>
			<result property="hengkouxianxiankuan" column="hengkouxianxiankuan" dbType="Decimal"/>
			<result property="hengkouxianshuliang" column="hengkouxianshuliang" dbType="Int"/>
			<result property="hengkouxian1xiankuan" column="hengkouxian1xiankuan" dbType="Decimal"/>
			<result property="hengkouxian1shuliang" column="hengkouxian1shuliang" dbType="Int"/>
			<result property="likouxianxiankuan" column="likouxianxiankuan" dbType="Decimal"/>
			<result property="likouxianshuliang" column="likouxianshuliang" dbType="Int"/>
			<result property="likouxian1xiankuan" column="likouxian1xiankuan" dbType="Decimal"/>
			<result property="likouxian1shuliang" column="likouxian1shuliang" dbType="Int"/>
			<result property="likouxian2xiankuan" column="likouxian2xiankuan" dbType="Decimal"/>
			<result property="likouxian2shuliang" column="likouxian2shuliang" dbType="Int"/>
			<result property="shangmao" column="shangmao" dbType="VarChar"/>
			<result property="youqileixing" column="youqileixing" dbType="VarChar"/>
			<result property="youqiyansekuangban" column="youqiyansekuangban" dbType="VarChar"/>
			<result property="youqiyansekouxian" column="youqiyansekouxian" dbType="VarChar"/>
			<result property="jiage" column="jiage" dbType="Decimal"/>
			<result property="dinggoushuliang" column="dinggoushuliang" dbType="Int"/>
      <result property="mupi" column="mupi" dbType="VarChar"/>
		</resultMap>
	</resultMaps>
	
	<statements>

		<select id="GetCount" resultClass="System.Int32">
			SELECT count(*) FROM [dbo].[orderDetailKou]
		</select>
		
		<select id="GetCountByCondition" parameterClass="Hashtable" resultClass="System.Int32" extends="GetCount">
			WHERE $condition$
		</select>
		
		<select id="FindAll" resultClass="OrderDetailKou">
			SELECT * 
			FROM [dbo].[orderDetailKou]
		</select>
		
		<select id="GetModel" parameterClass="OrderDetailKou" resultClass="OrderDetailKou" extends="FindAll">
			WHERE
				([orderDetailKou].[id] = #id,dbType=Int#)
		</select>

		<insert id="Insert" parameterClass="OrderDetailKou">
      INSERT INTO [dbo].[orderDetailKou] (

      [orderId] ,
      [name] ,
      [guigegao] ,
      [guigekuan] ,
      [guigeshen] ,
      [danshuangkou] ,
      [jicaikuangban] ,
      [jicaikouxian] ,
      [kouxianxianxing] ,
      [hengkouxianxiankuan] ,
      [hengkouxianshuliang] ,
      [hengkouxian1xiankuan] ,
      [hengkouxian1shuliang] ,
      [likouxianxiankuan] ,
      [likouxianshuliang] ,
      [likouxian1xiankuan] ,
      [likouxian1shuliang] ,
      [likouxian2xiankuan] ,
      [likouxian2shuliang] ,
      [shangmao] ,
      [youqileixing] ,
      [youqiyansekuangban] ,
      [youqiyansekouxian] ,
      [jiage] ,
      [dinggoushuliang],
      [mupi]
      ) VALUES (

      #orderId,dbType=Int# ,
      #name,dbType=VarChar# ,
      #guigegao,dbType=Decimal# ,
      #guigekuan,dbType=Decimal# ,
      #guigeshen,dbType=Decimal# ,
      #danshuangkou,dbType=VarChar# ,
      #jicaikuangban,dbType=VarChar# ,
      #jicaikouxian,dbType=VarChar# ,
      #kouxianxianxing,dbType=VarChar# ,
      #hengkouxianxiankuan,dbType=Decimal# ,
      #hengkouxianshuliang,dbType=Int# ,
      #hengkouxian1xiankuan,dbType=Decimal# ,
      #hengkouxian1shuliang,dbType=Int# ,
      #likouxianxiankuan,dbType=Decimal# ,
      #likouxianshuliang,dbType=Int# ,
      #likouxian1xiankuan,dbType=Decimal# ,
      #likouxian1shuliang,dbType=Int# ,
      #likouxian2xiankuan,dbType=Decimal# ,
      #likouxian2shuliang,dbType=Int# ,
      #shangmao,dbType=VarChar# ,
      #youqileixing,dbType=VarChar# ,
      #youqiyansekuangban,dbType=VarChar# ,
      #youqiyansekouxian,dbType=VarChar# ,
      #jiage,dbType=Decimal# ,
      #dinggoushuliang,dbType=Int#,
      #mupi,dbType=NVarChar#
      )
    </insert>

		<update id="Update" parameterClass="OrderDetailKou">
      UPDATE [dbo].[orderDetailKou] SET
      [orderId] = #orderId,dbType=Int#
      , [name] = #name,dbType=VarChar#
      , [guigegao] = #guigegao,dbType=Decimal#
      , [guigekuan] = #guigekuan,dbType=Decimal#
      , [guigeshen] = #guigeshen,dbType=Decimal#
      , [danshuangkou] = #danshuangkou,dbType=VarChar#
      , [jicaikuangban] = #jicaikuangban,dbType=VarChar#
      , [jicaikouxian] = #jicaikouxian,dbType=VarChar#
      , [kouxianxianxing] = #kouxianxianxing,dbType=VarChar#
      , [hengkouxianxiankuan] = #hengkouxianxiankuan,dbType=Decimal#
      , [hengkouxianshuliang] = #hengkouxianshuliang,dbType=Int#
      , [hengkouxian1xiankuan] = #hengkouxian1xiankuan,dbType=Decimal#
      , [hengkouxian1shuliang] = #hengkouxian1shuliang,dbType=Int#
      , [likouxianxiankuan] = #likouxianxiankuan,dbType=Decimal#
      , [likouxianshuliang] = #likouxianshuliang,dbType=Int#
      , [likouxian1xiankuan] = #likouxian1xiankuan,dbType=Decimal#
      , [likouxian1shuliang] = #likouxian1shuliang,dbType=Int#
      , [likouxian2xiankuan] = #likouxian2xiankuan,dbType=Decimal#
      , [likouxian2shuliang] = #likouxian2shuliang,dbType=Int#
      , [shangmao] = #shangmao,dbType=VarChar#
      , [youqileixing] = #youqileixing,dbType=VarChar#
      , [youqiyansekuangban] = #youqiyansekuangban,dbType=VarChar#
      , [youqiyansekouxian] = #youqiyansekouxian,dbType=VarChar#
      , [jiage] = #jiage,dbType=Decimal#
      , [dinggoushuliang] = #dinggoushuliang,dbType=Int#
      , [mupi] = #mupi,dbType=NVarChar#
      WHERE
      ([id] = #id,dbType=Int#)
    </update>

		<delete id="Delete" parameterClass="OrderDetailKou">
			DELETE FROM [dbo].[orderDetailKou]
			WHERE
				([id] = #id,dbType=Int#)
		</delete>

		<select id="GetModelsByCondition" parameterClass="Hashtable" resultClass="OrderDetailKou">
			SELECT $columnNames$ FROM [dbo].[orderDetailKou] where $condition$
		</select>
		
		<select id="GetModelsByConditionByPager" parameterClass="Hashtable" resultClass="OrderDetailKou">
			SELECT * FROM 
			(select $columnNames$,row_number() over(order by $orderBy$) as rno from [dbo].[orderDetailKou] where $condition$) t 
			<![CDATA[
			where t.rno>#startNo# and t.rno<=#endNo#
			]]>
		</select>
		
	</statements>
</sqlMap>
